
CC=gcc 
CXX=g++
target=librpc.so

FLAGS+= -g
LINK_FLAGS += -shared
LIB+= ws2_32.lib
#-lpthread 
INCLUDE=-I./os \
	-I./rpc \
	-I./tlv

objects=./os/os.o \
	./os/os_socket.o \
	./os/os_thread.o \
	./rpc/rpcclient.o \
	./rpc/rpcclientagent.o \
	./rpc/rpcserver.o \
	./tlv/tlv.o
link_objects=./os/os.o \
	./os/os_socket.o \
	./os/os_thread.o \
	./rpc/rpcclient.o \
	./rpc/rpcclientagent.o \
	./rpc/rpcserver.o \
	./tlv/tlv.o

all: $(target)

$(target): ${objects}
	${CXX} $(LINK_FLAGS) -o $@ ${link_objects} ${MACROS} ${DEBUG} ${LIB}

%.o: %.c
	${CC} ${INCLUDE} ${DEBUG} ${FLAGS} -c $< -o $@
	
%.o: %.cpp
	${CXX} ${INCLUDE} ${DEBUG} ${FLAGS} -c $< -o $@

.PHONY : clean

clean:
	rm -rf $(target) ${OBJEXE} *.o *.d *.dSYM ${objects}

